//
//  LzwNewTearTableCell.m
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/1.
//  Copyright © 2016年 刘志武. All rights reserved.
//

#import "LzwNewTearTableCell.h"
#import "LzwBaseImageView.h"
#import "LzwBaseLable.h"
#import "UIImageView+WebCache.h"

@interface LzwNewTearTableCell ()

@property (nonatomic, retain) LzwBaseImageView *myNewImage;
@property (nonatomic, retain) LzwBaseImageView *myNewImage1;

@property (nonatomic, retain) LzwBaseLable *myLable;
@property (nonatomic, retain) LzwBaseLable *myLable1;

@end

@implementation LzwNewTearTableCell

-(void)dealloc{
    [_myLable release];
    [_myLable1 release];
    [_myNewImage release];
    [_myNewImage1 release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatNewYear];
    }
    return self;
    
}

-(void)creatNewYear{
    
    //图片
    self.myNewImage = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(2 * WIDTH, 2 * WIDTH, 370 * WIDTH, 180 * WIDTH)];
    self.myNewImage.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.myNewImage];
    
    //喜爱图片
    self.myNewImage1 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 70 * WIDTH, 230 * WIDTH, 20 * WIDTH, 20 * WIDTH)];
    self.myNewImage1.image = [UIImage imageNamed:@"love.png"];
    [self.contentView addSubview:self.myNewImage1];
    
    //描述
    self.myLable = [[LzwBaseLable alloc]initWithFrame:CGRectMake(2 * WIDTH, 185 * WIDTH, 369 * WIDTH, 45 * WIDTH)];
    self.myLable.textColor = [UIColor lightGrayColor];
    self.myLable.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLable.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLable];
    
    //喜爱人数
    self.myLable1 = [[LzwBaseLable alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 50 + 5 * WIDTH, 230 * WIDTH, 60 * WIDTH, 20 * WIDTH)];
    self.myLable1.textColor = [UIColor lightGrayColor];
    self.myLable1.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLable1.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLable1];

    
}

-(void)setModleNewyear:(LzwModleNewTwo *)modleNewyear{
    
    if (_modleNewyear != modleNewyear) {
        [_modleNewyear release];
        
        _modleNewyear = [modleNewyear retain];
    }
    
    self.myLable.text = self.modleNewyear.title;
    self.myLable1.text = self.modleNewyear.likes;
    
    NSURL *url = [NSURL URLWithString:self.modleNewyear.pic];
    
    [self.myNewImage sd_setImageWithURL:url placeholderImage:nil];
    
    
}


@end
